/*
 * @Description: 中国路由服务
 * @Author: Mr.Wen
 * @Version: v1.0.0
 * @Date: 2022-07-30 10:38:17
 * @LastEditors: Mr.Wen - 文先生
 * @LastEditTime: 2023-05-23 09:36:54
 */

'use strict';

const express = require('express');
const router = express.Router();

const fs = require('fs');

const { filesPath } = require('@/routes/configPath');

/**
 * 中国城市信息
 * method：GET
 * params：无
 */

router.get('/china/city', (req, res) => {
  let resultData = fs.readFileSync(filesPath('china-data/city.json'), 'utf-8');

  let json = {
    status: 0,
    code: 200,
    message: '操作成功',
    req_url: req.originalUrl,
    api_url: '/china/city',
    result: JSON.parse(resultData),
  };

  res.send(json);
  return;
});

module.exports = router;
